<form id="frm_banner_edit" method="POST" action="<?php echo $save_action; ?>" enctype="multipart/form-data">
    <?php $this->load->view('site/banner/message'); ?>
    <input id="entity_id" type="hidden" name="id" value="<?php echo $banner->id; ?>" />
    <div class="clearfix auto_height mb_10">
        <?php $buttons = $this->load->view('admin/site/banner/buttons', null, true); echo $buttons; ?>
    </div>
    <div class="form_block">
        <div class="block_header">
            Thông tin banner
        </div>
        <div class="block_content">
            <table cellpadding="0px" cellspacing="0px">
                <?php if (isset($zones) && $zones && count($zones) > 0) :?>
                <tr>
                    <td class="frm_label">Vùng hiển thị(*)</td>
                    <td class="frm_field">
                        <select class="std_input" name="data[zone_id]" style="width: 200px">
                            <?php foreach ($zones as $zone) :?>
                            <option <?php if ($zone->id == $banner->zone_id) :?>selected="selected"<?php endif; ?> value="<?php echo $zone->id; ?>"><?php echo $zone->heading; ?></option>
                            <?php endforeach; ?>
                        </select>
                    </td>
                </tr>
                <?php endif; ?>
                <tr>
                    <td class="frm_label">File uploaded(*)</td>
                    <td class="frm_field">
                        <?php $file = get_field($banner, 'file'); ?>
                        <?php if (!empty($file)) :?>
                        <a id="image_container" target="_blank" href="<?php echo render_src($file); ?>"><img src="<?php echo render_src($file); ?>" width="40px" style="vertical-align: middle; border: 2px solid #bbb" /></a>
                        <?php endif; ?>
                        <input type="file" name="data_file" />
                    </td>
                </tr>
                <tr>
                    <td class="frm_label">Tiêu đề(*)</td>
                    <td class="frm_field">
                        <input type="text" class="std_input required" name="data[name]" value="<?php echo $banner->name; ?>" />
                    </td>
                </tr>
                <tr>
                    <td class="frm_label">Mã banner</td>
                    <td class="frm_field">
                        <input type="text" class="std_input" name="data[alias]" value="<?php echo $banner->alias; ?>" />
                    </td>
                </tr>
                <tr>
                    <td class="frm_label">Thứ tự</td>
                    <td class="frm_field">
                        <input type="text" class="std_input required digits" name="data[sort_order]" value="<?php echo $banner->sort_order; ?>" />
                    </td>
                </tr>
                <tr>
                    <td class="frm_label">Liên kết</td>
                    <td class="frm_field">
                        <input type="text" class="std_input required" name="data[link]" id="data_link" value="<?php echo $banner->link; ?>" />
                        <button class="gray_btn" type="button" onclick="window.open($('#data_link').val())">
                            <span>Duyệt liên kết</span>
                        </button>
                    </td>
                </tr>
                <tr>
                    <td class="frm_label">Chiều dài</td>
                    <td class="frm_field">
                        <input type="text" class="std_input required" name="data[width]" value="<?php echo $banner->width; ?>" />
                    </td>
                </tr>
                <tr>
                    <td class="frm_label">Chiều rộng</td>
                    <td class="frm_field">
                        <input type="text" class="std_input required" name="data[height]" value="<?php echo $banner->height; ?>" />
                    </td>
                </tr>
                <tr>
                    <td class="frm_label">Hiển thị</td>
                    <td class="frm_field">
                        <select id="banner_display" class="std_input" name="data[display]" style="width: 200px">
                            <option value="-1">Chọn chế độ</option>
                            <?php foreach ($this->site_banner_model->get_display_mode() as $value => $label) :?>
                            <option <?php if ($banner->display == $value) :?>selected="selected"<?php endif; ?> value="<?php echo $value; ?>"><?php echo $label; ?></option>
                            <?php endforeach; ?>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td class="frm_label">Chuyển hướng</td>
                    <td class="frm_field">
                        <select id="banner_target" class="std_input" name="data[target]" style="width: 200px">
                            <option value="-1">Chọn chế độ chuyển hướng</option>
                            <?php foreach ($this->site_banner_model->get_target_mode() as $value => $label) :?>
                            <option <?php if ($banner->target == $value) :?>selected="selected"<?php endif; ?> value="<?php echo $value; ?>"><?php echo $label; ?></option>
                            <?php endforeach; ?>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td class="frm_label">Ẩn hiện(*)</td>
                    <td class="frm_field">
                        <label>
                            <input type="checkbox" value="1" <?php if ($banner->is_visible == 1) :?>checked="checked"<?php endif; ?> name="data[is_visible]" />
                            <span>Hiện / Ẩn</span>
                        </label>
                    </td>
                </tr>
                <tr>
                    <td class="frm_label">Hiển thị từ ngày</td>
                    <td class="frm_field">
                        <input name="data[visible_from]" placeholder="Hiển thị từ ngày" type="text" class="std_input date_picker" value="<?php echo render_date(get_field($banner, 'visible_from')); ?>" />
                    </td>
                </tr>
                <tr>
                    <td class="frm_label">Hiển thị đến ngày</td>
                    <td class="frm_field">
                        <input name="data[visible_to]" placeholder="Hiển thị đến ngày" type="text" class="std_input date_picker" value="<?php echo render_date(get_field($banner, 'visible_to')); ?>" />
                    </td>
                </tr>
            </table>
        </div>
    </div>
    <div class="clearfix auto_height">
        <?php echo $buttons; ?>
    </div>
</form>